﻿/*
Copyright © 2011 François Karman

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

See <license.txt> for the complete license of the software.
*/

using System;

namespace Simple.Storage
{
    /// <summary>
    /// Represents a grouped serializer.
    /// </summary>
    /// <remarks>
    /// This interface allows the creation of chain-of-responsibility based
    /// on the <see cref="ISerializer"/> interface.
    /// </remarks>
    public interface IGroupedSerializer : ISerializer
    {
        /// <summary>
        /// Retrieves a serializer for the specified type.
        /// </summary>
        /// <param name="type">The type to serialize.</param>
        /// <returns>The associated serializer; or <c>null</c>.</returns>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="type"/> parameter is <c>null</c>.
        /// </exception>
        ISerializer Retrieve(Type type);

        /// <summary>
        /// Adds a new serializer to the encapsulated groups.
        /// </summary>
        /// <param name="serializer">The serializer to be added.</param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="serializer"/> parameter is <c>null</c>.
        /// </exception>
        void Add(ISerializer serializer);
    }
}
